package com.youlai.boot.system.model.entity;

import com.mybatisflex.annotation.Column;
import com.mybatisflex.annotation.Id;
import com.mybatisflex.annotation.KeyType;
import com.mybatisflex.annotation.Table;
import com.youlai.boot.common.listener.CreatedByListenerFlag;
import com.youlai.boot.common.listener.UpdatedByListenerFlag;
import lombok.Getter;
import lombok.Setter;

import java.util.Date;

/**
 * 角色实体
 *
 * @author Ray
 * @since 2024/6/23
 */
@Getter
@Setter
@Table(value = "sys_role")
public class SysRoleEntity implements CreatedByListenerFlag, UpdatedByListenerFlag {
    /**
     * 主键ID
     */
    @Id(keyType = KeyType.Auto)
    private Long id;

    /**
     * 角色名称
     */
    @Column(value = "name")
    private String name;

    /**
     * 角色编码
     */
    @Column(value = "code")
    private String code;

    /**
     * 显示顺序
     */
    @Column(value = "sort")
    private Integer sort;

    /**
     * 角色状态(1-正常 0-停用)
     */
    @Column(value = "status")
    private Integer status;

    /**
     * 数据权限
     */
    @Column(value = "data_scope")
    private Integer dataScope;

    /**
     * 创建人ID
     */
    @Column(value = "created_by")
    private Long createdBy;

    /**
     * 更新人ID
     */
    @Column(value = "updated_by")
    private Long updatedBy;

    /**
     * 逻辑删除
     */
    @Column(value = "is_deleted", isLogicDelete = true)
    private Integer isDeleted;

    /**
     * 创建时间
     */
    @Column(value = "create_time", onInsertValue = "now()")
    private Date createTime;

    /**
     * 更新时间
     */
    @Column(value = "update_time", onInsertValue = "now()", onUpdateValue = "now()")
    private Date updateTime;
}